from datetime import datetime
from typing import Optional, List

from pydantic import Field

from models.common import RWModel, OID
from models.institution import Institution

# !!! 业务类型暂时存储成静态数据，后期看更改的频繁程度
business_types = [{
    "level": "first",
    "values": ["学术", "科普", "智库", "科创", "建家", "国际化"]
}, {
    "level": "second",
    "values": []
}, {
    "level": "third",
    "values": []
}]


class Business(RWModel):
    """业务信息"""
    id: Optional[OID] = Field(title="业务ID")
    name: Optional[str] = Field(title="业务名称")
    alias: Optional[List[str]] = Field(title="别名")
    institution_id: Optional[OID] = Field(title="组织部门ID")
    priority: Optional[int] = Field(title="重要性")
    note: Optional[str] = Field(title="文本信息")
    start_time: Optional[datetime] = Field(title="业务开办时间")
    end_time: Optional[datetime] = Field(title="业务停办时间")

    first_type: Optional[List[str]] = Field(title="业务一级类型")
    second_type: Optional[List[str]] = Field(title="业务二级类型")
    third_type: Optional[List[str]] = Field(title="业务三级类型")

    # 只显示不存储
    institution: Optional[Institution]


if __name__ == '__main__':
    b = Business()
    print(b.dict(exclude_unset=True))
